package Solution_1;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Solution_1 {
    public static void main(String[] args) {
        int arr [][] = new int[16][16];
        /* try {
            //重定向输入 方便改动数据
           System.out.println("请在data.in里输入 16*16 的二维整形数组");
            FileInputStream f = new FileInputStream("src/Solution_1/data.in");
            System.setIn(f);} catch (FileNotFoundException e) {
            e.printStackTrace();
        }*/
            Scanner in = new Scanner(System.in);

            int resultRow = 0,resultLine = 0,leftUp = 0,rightup = 0;
            for (int i = 0 ; i < 16 ; i++){
                for (int j = 0; j < 16; j++){
                    arr[i][j] = in.nextInt();
                }
            }
            System.out.println("所有行的累加结果：");
            for (int i = 0 ; i < 16 ; i++){

                for (int j = 0; j < 16; j++){
                    resultRow += arr[i][j]; //行累加和
                    resultLine += arr[j][i];//列累加和
                    if(i == j) leftUp += arr[i][i];
                    if((i + j) == 15) rightup += arr[i][j];
                }
                System.out.print("第 " + (i+1)+" 行的和是 " + resultRow);
                resultRow = 0;

                System.out.println("    第 " + (i+1)+" 列的和是 " + resultLine);
                resultLine = 0;
            }
            System.out.println("左上角到右下角的和是 " + leftUp + "      右上角到左下角的和是 " + rightup);


    }
}
